package com.example.mapper;

import com.example.Pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    //查询全部部门信息
    @Select("select * from dept")
    public List<Dept> list();


    @Delete("delete from dept where id = #{id}")
        //根据id删除部门信息
    void deleteById(Integer id);

    //添加部门信息
    @Insert("insert into dept (name, create_time, update_time) values (#{name},#{createTime},#{updateTime})")
    void insertDept(Dept dept);

    //修改部门信息
    @Update("update dept set name = #{name}, update_time = now() where id = #{id}")
    void updateDept(Dept dept);

    //根据id查询部门信息
    @Select("select * from dept where id = #{id}")
    Dept selcetDept(Integer id);
}
